package com.bailiban.aigou.admin.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bailiban.aigou.admin.dao.CommodityclassificationDao;
import com.bailiban.aigou.admin.entity.Classification;
import com.bailiban.aigou.admin.service.ICommodityclassificationService;
import com.bailiban.aigou.admin.utils.PageModel;
@Service
public class CommodityclassificationServiceImpl implements  ICommodityclassificationService{
    @Autowired 
	private CommodityclassificationDao commodityclassificationDao;
    
    @Transactional
    public PageModel<Classification> getCommodityclassification(PageModel<Classification> pageModel) {
		PageModel<Classification> pageModel2 = commodityclassificationDao.getCommodityclassification(pageModel);
		int count = commodityclassificationDao.getCommodityclassificationCount();
		pageModel2.setTotalRecords(count);
		return pageModel2;
	}
    /**
     * 添加商品分类
     * **/
    @Transactional
	public void save(Classification user) {
		commodityclassificationDao.save(user);
		
	}
	@Override
	@Transactional
	public Classification getProductTypeById(String id) {
		
		return commodityclassificationDao.getProductTypeById(id);
	}
	@Override
	@Transactional
	public void updateProductType(Classification classification) {
		commodityclassificationDao.updateProductType(classification);
		
	}
	@Override
	@Transactional
	public void deleteProductTypeById(String id) {
		commodityclassificationDao.deleteProductTypeById(id);
		
	}
	@Override
	@Transactional
	public List<Classification> getAllProductTypes() {
	
		return commodityclassificationDao.getAllProductTypes();
	}

    
	
	

	

}
